home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10267 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: ix.netcom.com!netnews
  2. From: David Brownell <brownell@ix.netcom.com>
  3. Newsgroups: comp.programming.threads,comp.lang.c++,comp.unix.osf.osf1,comp.unix.programmer,comp.object
  4. Subject: Re: Looking for best design for using pthreads in C++ objects
  5. Date: Wed, 06 Mar 1996 09:30:23 -1000
  6. Organization: Dave's VAX
  7. Message-ID: <313DE7CF.7AF1@ix.netcom.com>
  8. References: <3128ff8b.666031216@news.clark.net> <312A0E5F.7B2C@ix.netcom.com>
  9.             <31320705.41C6@zko.dec.com> <puag248wxl.fsf@themroc.colibri.de> <3134F4F5.167E@zko.dec.com>
  10. NNTP-Posting-Host: haw-ak1-06.ix.netcom.com
  11. Mime-Version: 1.0
  12. Content-Type: text/plain; charset=us-ascii
  13. Content-Transfer-Encoding: 7bit
  14. X-NETCOM-Date: Wed Mar 06 11:34:11 AM PST 1996
  15. X-Mailer: Mozilla 2.0 (Win95; I)
  16.  
  17. Webb Scales wrote:
  18. > Harald Fuchs wrote:
  19. > > It's simply too easy to forget an appropriate catch clause.
  20.  
  21. ... but if you have viable thread support from your C++ system,
  22. that'll never be an issue.  That was a premise in my original
  23. posting, as I recall:  the C++ exception runtime interacts in
  24. the natural way with the POSIX cancellation interface (i.e. the
  25. destructors are the C++ version of the C "cleanup handlers").
  26.  
  27. Admittedly POSIX.1c doesn't have a C++ binding yet.  But the
  28. rationale makes clear what's intended:  use the language's
  29. native exception handling facilities to handle cancellation.
  30.  
  31. > But, that's my point exactly!  If it's easy to forget the catch clause,
  32. > then it is even easier to forget to rectify the state of the shared
  33. > data.
  34.  
  35. These go together in all good MT-aware programming styles, just like
  36. policies like "mutex state isn't changed by function calls".  As with
  37. all style guidelines, they can be broken if you know what you're doing;
  38. I tend to call that "rocket science mode".
  39.  
  40. - Dave
  41.